package com.bytezero.webviewtest2;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView webView = findViewById(R.id.web_view);
        Button button = findViewById(R.id.bt_web);
        Button button1 = findViewById(R.id.intent);
        button.setOnClickListener(v -> {
            webView.getSettings().setJavaScriptEnabled(true);
            webView.setWebViewClient(new WebViewClient());
            webView.loadUrl("http://www.baidu.com");
        });

        button1.setOnClickListener(v -> {
            startActivity(new Intent(MainActivity.this,HttpActivity.class));
        });



    }
}